fix: recover Android app-owned ANRs#592
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b616d164d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const args of commands) { | ||
| const result = await runAndroidAdb(device, args, { allowFailure: true }); | ||
| const parsed = parseAndroidBlockingDialogFocus(result.stdout ?? ''); | ||
| if (parsed) return parsed; |
There was a problem hiding this comment.
Short-circuit ANR focus probe after first successful dumpsys
readAndroidBlockingDialogFocus currently iterates both dumpsys variants unless an ANR is detected, but null is the expected result in healthy sessions. That means every guarded Android action performs an unnecessary second adb shell dumpsys window probe (and this check runs both before and after commands), adding avoidable latency and ADB load on normal flows. This should stop after the first successful probe (for example when exit code is 0), and only fall back to the second command when the first probe fails or is unusable.
Useful? React with 👍 / 👎.
7fe79f0 to
4046d83
Compare
Summary
Recover app-owned Android ANR dialogs before guarded action commands by tapping the dialog close action, relaunching the session app, and continuing with a warning once focus returns.
Keep unrelated/system ANRs fail-fast with focused package/window context so agents get actionable feedback without closing external processes.
Closes #589
Touched files: 12. Scope stayed within Android blocking-dialog detection/recovery, daemon interaction/generic dispatch guards, and provider integration coverage.
Validation
Verified with provider integration coverage for app-owned ANR recovery and external ANR failure through the real daemon request path.
Ran
pnpm format,pnpm check:quick, andpnpm check:unit. The unit bundle initially had one unrelated Android install timeout, passed in isolation, then the full unit/smoke bundle passed on rerun.